/*
 +----------------------------------------------------------------------
 + Title        : friendApply
 + Author       : huwl
 + Version      : 1.0.0
 + Initial-Time : 2023-03-11
 + Last-time    : 这个文件最后修改的时间 + 修改人的名称
 + Desc         : 好友申请接口
 +----------------------------------------------------------------------
*/

import type { 
    AddFriendApplyParams,
    EditFriendApplyParams,
    FriendApplyListParams,
    FriendApplyListResult,
    FriendApplyTotalResult
} from '@/types/friendApply'
import {http} from '@/utils/httpRequest'

/**
 * 添加,请求方式[POST]
 * 
 * @param AddFriendApplyParams data ----------------------------请求参数
 * @returns any
 * @author huwl
 */
export const reqAddFriendApplyAPI = (data: AddFriendApplyParams) => {
    return http({
        method: 'POST',
        url: 'friendApply/add',
        data
    })
}

/**
 * 删除,请求方式[GET]
 * 
 * @param string ids -------------------------------------------请求参数
 * @returns 
 * @author huwl
 */
export const reqDeleteFriendApplyAPI = (ids: string) => {
    return http({
        method: 'GET',
        url: 'friendApply/delete',
        data: {ids}
    })
}

/**
 * 编辑,请求方式[POST]
 * 
 * @param EditFriendApplyParams data ---------------------------请求参数
 * @returns 
 * @author huwl
 */
export const reqEditFriendApplyAPI = (data: EditFriendApplyParams) => {
    return http({
        method: 'POST',
        url: 'friendApply/edit',
        data
    })
}

/**
 * 同意,请求方式[POST]
 * 
 * @param number id --------------------------------------------请求参数
 * @param string network ---------------------------------------请求参数
 * @returns 
 * @author huwl
 */
export const reqAgreeFriendApplyAPI = (id: number, network?: string) => {
    return http({
        method: 'POST',
        url: 'friendApply/agree',
        data: {id, network}
    })
}

/**
 * 列表,请求方式[GET]
 * 
 * @param FriendApplyListParams data ---------------------------请求参数
 * @returns FriendApplyListResult
 * @author huwl
 */
export const reqFriendApplyListAPI = (data: FriendApplyListParams) => {
    return http<FriendApplyListResult>({
        method: 'GET',
        url: 'friendApply/list',
        data
    })
}

/**
 * 数量,请求方式[GET]
 * 
 * @param FriendApplyListParams data ---------------------------请求参数
 * @returns FriendApplyTotalResult
 * @author huwl
 */
export const reqFriendApplyTotalAPI = (data: FriendApplyListParams) => {
    return http<FriendApplyTotalResult>({
        method: 'GET',
        url: 'friendApply/total',
        data
    })
}
